using System;
using System.Collections.Generic;
using PluginFrame;

namespace PcrDataStructure
{
    [Serializable]
    public abstract class SubModule : ISubModule
    {
        protected int mSubModuleID;

        protected List<IPcrCell> mPcrCells;

        protected IPcrExperiment mPcrExperiment;

        protected IPcrModule mPcrModule;

        protected readonly IConfigurationService mConfigurationService;

        IPcrExperiment ISubModule.PcrExperiment
        {
            get
            {
                return mPcrExperiment;
            }
            set
            {
                mPcrExperiment = value;
            }
        }

        IPcrModule ISubModule.PcrModule
        {
            get
            {
                return mPcrModule;
            }
            set
            {
                mPcrModule = value;
            }
        }

        int ISubModule.ID
        {
            get
            {
                return mSubModuleID;
            }
            set
            {
                mSubModuleID = value;
            }
        }

        List<IPcrCell> ISubModule.PcrCells
        {
            get
            {
                return mPcrCells;
            }
            set
            {
                mPcrCells = value;
            }
        }

        public bool IsAvailable()
        {
            return mPcrExperiment == null;
        }

        public bool IsBlank()
        {
            if (mPcrExperiment == null)
            {
                return true;
            }
            foreach (IPcrCell mPcrCell in mPcrCells)
            {
                if (mPcrCell.Project != null)
                {
                    return false;
                }
            }
            return true;
        }
    }
}
